<?php
    include 'common/mysql.inc.php';
    include 'common/config.inc.php';
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<title>小杰BBS论坛</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" type="text/css" href="/public/style/public.css" />
<link rel="stylesheet" type="text/css" href="/public/style/index.css" />
<style>
    div.left {width:650px; min-height:500px; padding:10px; border:1px #E4E4E4 solid; float:left;}
    div.link {border-bottom:1px #e4e4e4 solid; line-height:30px;}
    div.link a {color:#333; text-decoration:none;}
    div.link a:hover {color:#333; text-decoration:underline;}
    div.right {width:260px; min-height:500px; padding:10px; border:1px #E4E4E4 solid; float:right;}
    div.show p {line-height:30px;}
    div.column {width:100%; height:40px; font-size:14px; font-weight:bold; text-align:center; line-height:40px; border-radius:5px; color:#FFF; background-color:#488FCE;}
    div.right ol li {line-height:30px; text-indent:5px; border-bottom:1px #ccc dashed; list-style:inside decimal;}
    div.right ol li a {color:#333; text-decoration:none;}
    dvi.right ol li a:hover {color:#333; text-decoreation:underline;}
</style>
<script type='text/javascript' src='public/jquery-1.10.1.min.js'></script>
<script type='text/javascript' src='public/layer/layer.js'></script>
<script>

    $(function () {
        //退出登录
        $('#logout').click(function(){

            layer.confirm('确认退出吗?',{btn:['确认','取消']},function(){

                $.ajax({
                    type:'post',
                    url:'logout.php?act=logout',
                    dataType:'json',
                    success:function(res){

                        //关闭所有层
                        //layer.closeAll();

                        if(res.status==1){

                            layer.msg(res.msg, {icon: 6});
                            //setTimeout("history.back();",3000);
                            setTimeout("location.reload()",1500);
                        }else{

                            layer.msg(res.msg, {icon: 5});
                            //layer.closeAll();
                        }

                    }


                });

            },function(){



            });


        });

    });

</script>
</head>
<body>
    <div class="header_wrap">
        <div id="header" class="auto">
            <div class="logo">小杰论坛</div>
            <div class="nav">
                <a href='/' class="hover">首页</a>
            </div>
            <div class="serarch">
                <form>
                    <input class="keyword" type="text" name="keyword" placeholder="搜索其实很简单" />
                    <input class="submit" type="submit" name="submit" value="" />
                </form>
            </div>
            <?php if(empty($_SESSION['pro_username'])){  ?>
            <div class="login">
                <a href="login.php">登录</a>&nbsp;
                <a href="register.php">注册</a>
            </div>
            <?php }else{ ?>
            <a id="logout" style="color:#a25454;position: absolute;right: 50px;top: 0px;cursor: pointer;" >退出登录</a>
            <span style="float: right;color: #105cb6;">欢迎回来: <a style="color: white;cursor: pointer;"><?php echo $_SESSION['pro_username']; ?></a></span>


            <?php    }  ?>
        </div>
    </div>
    <div style="margin-top:20px;"></div>
    <div id="hot" class="auto">
        <div class="left">
            <div class='link'>
                <a href="/">首页</a> >  <a href="#">热门动态</a>
            </div>
            <div style="clear:both; height:20px;"></div>
            <div class="show">
                <h1>
                [<?php
                    foreach($newstype as $v) {
                        if($row['cid'] == $v[0]) {
                            echo $v[1];
                        }
                    }
                ?>] 
                <?php echo $row['title'];?></h1>
                <div style="height:20px;"></div>
                <div>发布时间：<?php echo $row['addtime'];?></div>
                <div style="height:20px;"></div>
                <div>
                    <?php
                        echo $row['content'];
                    ?>
                </div>
            </div>
        </div>
        <div class="right">
            <div class="column">
                热门新闻
            </div>
            <div style="height:20px;"></div>
            <ol>
                <?php
                    foreach($data as $v){
                ?>
                <li><a href='news.php?id=<?php echo $v["id"];?>'><?php echo $v['title'];?></a></li>

                <?php
                    }
                ?>

            </ol>
        </div>
        <div style="clear:both;"></div>
    </div>
    <div id="footer" class="auto">
        <div class="bottom">
            <a>zhaoxiaojie</a>
        </div>
        <div class="copyright">Powered by zxj ©2015 www.zhaoxiaojie.club</div>
    </div>
</body>
</html>